home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / linux-bo / dless-li / root.no / etc / rc.d / rc.S < prev    next >
Text File  |  1995-04-28  |  4KB  |  129 lines

  1. #!/bin/sh
  2. #
  3. # /etc/rc
  4. #
  5. # These commands are executed at boot time by init(8).
  6. # User customization should go in /etc/rc.local.
  7.  
  8. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  9.  
  10. # enable swapping
  11. #/sbin/swapon -a
  12.  
  13. # Start update.
  14. #/sbin/update &
  15.  
  16. # Test to see if the root partition is read-only, like it ought to be.
  17. READWRITE=no
  18. if echo -n >> "Testing filesystem status"; then
  19.  rm -f "Testing filesystem status"
  20.  READWRITE=yes
  21. fi
  22.  
  23. # Check the integrity of all filesystems
  24. if [ ! $READWRITE = yes ]; then
  25.  /sbin/fsck -A -a
  26.  # If there was a failure, drop into single-user mode.
  27.  if [ $? -gt 1 ] ; then
  28.   echo
  29.   echo
  30.   echo "**************************************"
  31.   echo "fsck returned error code - REBOOT NOW!"
  32.   echo "**************************************"
  33.   echo
  34.   echo
  35.   /bin/login 
  36.  fi
  37.  # Mount the /proc FS
  38.  echo "Mounting /proc filesystem...."
  39.  # /bin/mount /proc /proc -t proc
  40.  # Remount the root filesystem in read-write mode
  41.  echo "Remounting root device with read-write enabled."
  42.  /bin/mount -w -n -o remount /
  43.  if [ $? -gt 0 ] ; then
  44.   echo
  45.   echo "Attempt to remount root device as read-write failed!  This is going to"
  46.   echo "cause serious problems...  "
  47.   echo 
  48.   echo "If you're using the UMSDOS filesystem, you **MUST** mount the root partition"
  49.   echo "read-write!  You can make sure the root filesystem is getting mounted "
  50.   echo "read-write with the 'rw' flag to Loadlin:"
  51.   echo
  52.   echo "loadlin vmlinuz root=/dev/hda1 rw   (replace /dev/hda1 with your root device)"
  53.   echo
  54.   echo "Normal bootdisks can be made to mount a system read-write with the rdev command:"
  55.   echo
  56.   echo "rdev -R /dev/fd0 0"
  57.   echo
  58.   echo "You can also get into your system by using a bootkernel disk with a command"
  59.   echo "like this on the LILO prompt line:  (change the root partition name as needed)"
  60.   echo 
  61.   echo "LILO: mount root=/dev/hda1 rw"
  62.   echo
  63.   echo "Please press ENTER to continue, then reboot and use one of the above methods to"
  64.   echo -n "get into your machine and start looking for the problem. " 
  65.   read junk; 
  66.  fi
  67. else
  68.  echo "Testing filesystem status: read-write filesystem"
  69.  if [ -d /DOS/linux/etc -a -d /DOS/linux/dev ]; then # no warn for UMSDOS
  70.   cat << EOF
  71.  
  72. *** ERROR: Root partition has already been mounted read-write. Cannot check!
  73.  
  74. For filesystem checking to work properly, your system must initially mount
  75. the root partition as read only. Please modify your kernel with 'rdev' so that
  76. it does this. If you're booting with LILO, add a line:
  77.  
  78.    read-only
  79.  
  80. to the Linux section in your /etc/lilo.conf and type 'lilo' to reinstall it.
  81.  
  82. If you boot from a kernel on a floppy disk, put it in the drive and type:
  83.   rdev -R /dev/fd0 1
  84.  
  85. If you boot from a bootkernel disk, or with Loadlin, you can add the 'ro' flag.
  86.  
  87. This will fix the problem *AND* eliminate this annoying message. :^)
  88.  
  89. EOF
  90.   echo -n "Press ENTER to continue. "
  91.   read junk;
  92.  fi
  93. fi
  94.  
  95. # remove /etc/mtab* so that mount will create it with a root entry
  96. /bin/rm -f /etc/mtab* /etc/nologin /var/adm/utmp
  97.  
  98. # Looks like we have to create this.
  99. cat /dev/null >> /var/adm/utmp
  100.  
  101. # Configures the network neccesary for mounting remote FS
  102. sh /etc/rc.d/rc.bootp
  103.  
  104. # mount file systems in fstab (and create an entry for /)
  105. #/sbin/mount -avt nonfs
  106. mount -av
  107. mount /proc /proc -t proc
  108.  
  109. # Configure the system clock.
  110. # This can be changed if your system keeps GMT.
  111. if [ -x /sbin/clock ]; then
  112.   /sbin/clock -s
  113. fi
  114.  
  115. # Setup the /etc/issue and /etc/motd to reflect the current kernel level:
  116. # THESE WIPE ANY CHANGES YOU MAKE TO /ETC/ISSUE AND /ETC/MOTD WITH EACH
  117. # BOOT. COMMENT THEM OUT IF YOU WANT TO MAKE CUSTOM VERSIONS.
  118. echo > /etc/issue
  119. echo Welcome to Linux `/bin/uname -a | /bin/cut -d\  -f3`. >> /etc/issue
  120. echo >> /etc/issue
  121. echo "`/bin/uname -a | /bin/cut -d\  -f1,3`. (POSIX)." > /etc/motd
  122.  
  123. # Run serial port setup script:
  124. # (CAREFUL! This can make some systems hang if the rc.serial script isn't
  125. # set up correctly. If this happens, you may have to edit the file from a
  126. # boot disk)
  127. #
  128. #/bin/sh /etc/rc.d/rc.serial
  129.